package com.study.zzedu.fragment.home;

import android.content.Context;
import android.text.TextUtils;

import com.study.zzedu.base.BaseModel;
import com.study.zzedu.http.OnResultListener;
import com.study.zzedu.utils.AppConstant;
import com.study.zzedu.utils.LogUtil;
import com.study.zzedu.utils.OkHttpUtils;

import org.json.JSONObject;

/**
 */

public class VideoTabModel extends BaseModel {

    public void getDataHeader(Context context, final OnResultListener resultListener){
//        if (TextUtils.isEmpty(AppConstant.userCode)) {
//            LogUtil.e("Forget", "学号异常");
//            return;
//        }
        OkHttpUtils.getInstance(context).getJsonForString(OkHttpUtils.BASE_URL + "/appCourse/queryMyCourseResult",
                null,
                null, new OkHttpUtils.HttpCallBack() {
                    @Override
                    public void onSuccess(String obj) {
                        try {
                            JSONObject jObject = new JSONObject(obj);
                            if (0 == jObject.getInt("code")) {
                                resultListener.onSuccess(obj);
                            } else {
                                resultListener.onError(jObject.get("message").toString());
                            }
                        } catch (Exception e) {
                            e.toString();
                        }
                    }
                    @Override
                    public void onSuccess(JSONObject obj) {
                        //resultListener.onSuccess(obj.toString());
                    }
                    @Override
                    public void onError(String msg) {
                        resultListener.onError(msg);
                    }
                });
    }



}
